#ifndef BRKS_BUF_USERM_HANDLER_H
#define BRKS_BUF_USERM_HANDLER_H

#include "glo_def.h"
#include "iEventHandler.h"
#include "events_def.h"
#include "threadpool/threadpool/thread.h"

#include <string>
#include <map>
#include <memory>

class UserEventHandler : public iEventHandler {
public:
	UserEventHandler();
	virtual ~UserEventHandler();
	virtual iEvent* handle(const iEvent* ev);
private:
	MobileCodeRspEv* handle_mobile_code_req(MobileCodeReqEv* ev);
	LoginRspEv* handle_login_req(LoginReqEv* ev);
	RechargeRspEv* handle_recharge_req(RechargeReqEv* ev);
	i32 code_gen();

private:
	std::string mobile_;
	std::map<std::string, i32>m2c_;//first is mobile, second is code
	pthread_mutex_t pm_;
};

#endif